import { ref, watch, reactive, getCurrentInstance } from 'vue'
import {Search, Plus, Upload} from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import $button from '@/button'
const proxy = getCurrentInstance();

export const operationItem = reactive({
    defaultSearch: false,//默认搜索按钮
    defaultRefresh: false,//默认重置按钮
    customTableHeader: false,//
    SearchItem: [
        {
            code: 'orderNum',
            name: '订单号',
            type: 'input',
        },
        {
            code: 'sale',
            name: '商家名称/编号',
            type: 'input',
        },
        {
            code: ['payDateStart', 'payDateEnd'],//
            startName: "支付日期", //默认是开始时间 type为 daterange生效
            rangeName: "", //默认是至 type为 daterange生效
            endName: "支付日期", //默认是结束时间 type为 daterange生效
            valueFormat: "", //默认是YYYY-MM-DD
            placeholder: "请选择日期",//默认是请选择日期type为date生效
            type: "daterange",//daterange或date
        }
    ],
    menuArray: [
        {
            show: true,
            type: 'primary',
            text: '查询',
            icon: Search,
            handle: () => {
            }
        },
        {
            show: true,
            type: 'primary',
            text: '导出',
            hasPermi: [$button.courseorderCommissionexport|| null],
            icon: Upload,
            handle: () => {
            }
        },
    ]
})

export const tableItem = reactive({
    select: false,
    index: !true,
    tree: true,
    expandAll: true,
    align: 'center',
    column: [
        {
            label: '订单号',
            prop: 'orderNum',
            align: 'center',
        },
        {
            label: '支付时间',
            prop: 'payTime',
            align: 'center',
        },
        {
            label: '支付金额(元)',
            prop: 'payPrice',
            align: 'center',
        },
        {
            label: '退款金额(元)',
            prop: 'refundPrice',
            align: 'center',
        },
        {
            label: '返利比例',
            prop: 'rate',
            align: 'center',
            htmlContent: row => {
                return `<span>${(row.rate || '0') + '%'}</span>`
            },
        },
        {
            label: '返利金额(元)',
            prop: 'price',
            align: 'center',
        },
        {
            label: '商家名称',
            prop: 'sale',
            align: 'center',
        },
        {
            label: '商家级别',
            prop: 'saleLevel',
            align: 'center',
        }
    ],
    pageInfo: {
        request: {
            'orderNum': '',
            'sale': '',
            // 'startCreateTime': '',
            // 'endCreateTime': '',
            'pageDomain': {
                'pageNum': '1',//分页页面数
                'pageSize': '10',//分页页面数据大小
                'orderByColumn': '',//搜索参数
                'isAsc': '',//搜索参数
                'reasonable': ''//搜索参数
            }
        },
        url: '/sale/commission/paging',//分页路由，不传的话需要传入自定义的分页函数paging 传入时定义的分页函数paging会失效 /sale/commission/paging
        method: 'POST',//分页请求方法，不传默认为POST
        // 分页函数paging
        paging: function () {
        }
    },
    // 分页数据 自定义分页函数paging时需要把值赋给tableData
    tableData: {
        total: '',//分页总计
        // 分页数据
        data: []
    },
    // 操作栏按钮
    btnArray: [
    ],
    moreBtnArrayText: '',
    moreBtnArray: [],
    // 选择框触发
    selectChange: function (row) {
    },
}
)



